//
//  UIView+SpinAnimation.h
//  EnTT
//
//  Created by 罗 亮富 on 16/6/10.
//
//

#import <UIKit/UIKit.h>

@interface UIView (SpinAnimation)

@property (nonatomic, weak, readonly) CAShapeLayer *ringLayer;

@property (nonatomic, weak, readonly) CAShapeLayer *spinLayer;

@property (nonatomic) float ringDuration; //default is 1.5s

@property (nonatomic) CGFloat ringWidth;//defaut is 1.5 point

@property (nonatomic) CGFloat ringRadium; //default is MAX(width,height)/2

@property (nonatomic, readonly) BOOL isRinging;//

-(void)ringAnimate:(BOOL)animte;

-(void)blinkAnimate:(BOOL)animte;

-(void)spinAnimate:(BOOL)animte;


@property (nonatomic, readonly) UIActivityIndicatorView *activityIndicator;
-(void)startActivityIndicator;
-(void)stopActivityIndicator;

@end



@interface UIButton (SpinAnimation)

@property (nonatomic) BOOL ringWhenSelected;
@property (nonatomic) BOOL blinkWhenSelected;

@property (nonatomic, copy) UIColor *selectedTintColor;

@end


//use a arc to indicate the progress
@interface ArcProgressView : UIView


+(instancetype)prgArcViewAroundView:(nonnull UIView *)view;

@property (nonatomic) float progressValue;//value range: 0 to 1.0

@property (nonatomic) CGFloat lineWidth; // default is 2.0
@property(nonatomic, strong) UIColor* progressTintColor;//default is self.tintColor
@property(nonatomic, strong, nullable) UIColor* trackTintColor;

-(void)updateArc;

@end
